import request from '@/utils/request'
import axios from 'axios'

/**
 * 获取商品详情
 * @param {String} id - 商品ID
 */
export const findGoods = id => {
  return request({
    method: 'get',
    url: '/goods',
    params: {
      id
    }
  })
}

/**
 * 获取城市数据
 * @returns Promise
 */
export const getCityData = () => {
  // 注意：城市数据并不是直接从接口中获取，而是从阿里云上获取的
  const url = 'https://yjy-oss-files.oss-cn-zhangjiakou.aliyuncs.com/tuxian/area.json'
  return new Promise((resolve, reject) => {
    axios.get(url).then(res => {
      resolve(res.data)
    })
  })
}
